home *** CD-ROM | disk | FTP | other *** search
- Path: news.iag.net!news
- From: jatmon@iag.net (John R Buchan)
- Newsgroups: comp.lang.c
- Subject: Re: Using ARGV on VAX - how?
- Date: 5 Jan 1996 17:24:16 GMT
- Organization: Internet Access Group, Orlando, Florida
- Message-ID: <4cjms0$i5s@news.iag.net>
- References: <1996Jan5.091249.1@vax.sbu.ac.uk>
- NNTP-Posting-Host: pm3-orl15.iag.net
- X-Newsreader: WinVN 0.99.7
-
- In article <1996Jan5.091249.1@vax.sbu.ac.uk>, tonyh@vax.sbu.ac.uk says...
- >
- <snip>
- >main (int argc, char *argv[])
- >{
- > if (argv != 2) {
-
- argv is a pointer to a pointer to a char. It is unlikely to equal 2.
- I suspect that you intended to write:
-
- if (argc != 2) {
-
- > printf("you forgot to enter your name");
- > exit(1);
- > }
- > printf("Hello %s", argv[1]);
- >}
- >when i type exe myfile.c tony it should produce 'Hello Tony'
- >but all i get is :
- >
- > "you forgot to enter your name"
-
- I assume you are including strio.h? You should probably add a return
- statement to the end of main.
-
- --
- John R Buchan -:|:- Looking for that elusive FAQ? ftp to:
- jatmon@mail.iag.net -:|:- rtfm.mit.edu /pub/usenet-by-group/....
-
-